package com.wzm.moviepic.slidingmenu;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

import com.slidingmenu.lib.SlidingMenu;
import com.wzm.moviepic.R;
import com.wzm.moviepic.fragment.LeftFragment;
import com.wzm.moviepic.fragment.HistoryFragment;

public class BaseActivity extends SlidingFragmentActivity
{

    protected Fragment    mFrag;

    protected SlidingMenu slidingMenu;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setBehindContentView(R.layout.left_frame);
       
        

        slidingMenu = getSlidingMenu();
        slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
        slidingMenu.setShadowWidth(getWindowManager().getDefaultDisplay().getWidth() / 40);
        slidingMenu.setShadowDrawable(R.drawable.shadow);
        slidingMenu.setSecondaryShadowDrawable(R.drawable.right_shadow);
        slidingMenu.setBehindOffset(getWindowManager().getDefaultDisplay().getWidth() / 8);
        slidingMenu.setFadeEnabled(true);
        slidingMenu.setFadeDegree(0.4f);
        slidingMenu.setBehindScrollScale(0);
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        
        //左边
        FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
        mFrag = new LeftFragment();
        t.replace(R.id.left_frame, mFrag);
        //右边
        HistoryFragment rightFrag = new HistoryFragment();
        slidingMenu.setSecondaryMenu(R.layout.right_frame);
        t.replace(R.id.right_frame, rightFrag);
        t.commit();
    }

}
